var sellerId = $("#sellerId").val();
//轮播图
var mySwiper = new Swiper('.photo-swiper', {
		autoplay: 3000,//可选选项，自动滑动
		loop:true,
		autoplayDisableOnInteraction:false
	})
var activitySwiper = new Swiper('.activity-swiper', {
		freeMode : true,
		slidesPerView:'4',
	})
var typeSwiper = new Swiper('.type-swiper', {
		freeMode : true,
		slidesPerView:'5',
	})
window.onscroll = function(){
	//懒加载
	lazyLoad($(".lazy[data-load='false']"));
	position2fixed($(".activity-contianer"));
}
//格式化轮播图，商店LOGO图
FormatImg($(".format"),$(".format").parents(".swiper-container"));
FormatImg($(".shop-logo-format"),$(".shop-logo-format").parents(".img-container"));
//改变位置
function position2fixed(contianer){
	var top = contianer.offset().top;
	var scrollTop = $('body').scrollTop();
	if(scrollTop>top){
		if($(".absolute2fix-container").css("position")=="fixed"){
			return false;
		}else{
			$(".absolute2fix-container").css("position","fixed");
		}

	}else{
		if($(".absolute2fix-container").css("position")=="absolute"){
			return false;
		}else{
			$(".absolute2fix-container").css("position","absolute");
		}
	}
}
//点击活动专场、活动分类
//注意这里！！！因为第一个不能点击所以这里还是要有的，如果没有这句，点击“活动专场”、“活动分类”会触发事件
$(".horizontal-swiper").on("click","a",function(){
	//禁止“活动专场”、“活动分类”的点击事件
	if($(this).hasClass("disabled")){
		return false;
	}
	//其他事件,
	var _this = $(this);
	$(this).parents("ul").each(function(){
		$(this).find(".active").removeClass("active");
		_this.find("span").addClass("active");
	})
})

//查看邮费
$(".postage").on("tap",function(){
	$(".check-postage").before("<div class='shadow'></div>");
	$(".check-postage").find("tbody").empty();
	$.ajax({
		type:"get",
		url:base_url+"customer/getShopPostageMsgs",
		data:{"sellerId":sellerId},
		async:false,
		success:function(data){
			console.log(data);
			var othersArea = '<tr>'
				+'<td>其他</td>'
				+'<td>'+data.deProductFreight+'元</td>'
				+'<td>'+data.deFulfilWithoutFreight+'元</td>'
				+'</tr>';
			$(".check-postage").find("tbody").append(othersArea);
			var postageMsgs = data.postageMsgs;
			for(var i=0;i<postageMsgs.length;i++){
				var area = '<tr>'
					+'<td>'+postageMsgs[i].provinceName+'</td>'
					+'<td>'+postageMsgs[i].postageSystem.productFreight+'元</td>'
					+'<td>'+postageMsgs[i].postageSystem.fulfilWithoutFreight+'元</td>'
					+'</tr>'
					$(".check-postage").find("tbody").append(area);
			}
		},
		error:function(){
		}
	});
	$(".check-postage").fadeIn();
	clickShadow(function(){
		$(".check-postage").fadeOut();
	})
})